package com.woniu.utils;

import org.springframework.amqp.core.ReturnedMessage;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

@Component
public class RabbitMessageUtil implements RabbitTemplate.ConfirmCallback, RabbitTemplate.ReturnsCallback {


    @Override
    public void returnedMessage(ReturnedMessage returnedMessage) {
        if (!returnedMessage.getRoutingKey().equals(ConstantUtil.EXCHANGE_CHECK_ORDER_STATUS)) {
            System.out.println("消息没有到达队列");
        }

    }


    @Override
    public void confirm(CorrelationData correlationData, boolean ack, String cause) {

        if (!ack) {
            System.out.println("消息没有到达交换机");
        }
    }
}
